#ifndef _KLAS_RECTANGLE_HPP_
#define _KLAS_RECTANGLE_HPP_

#include "../include/Vector2.hpp"

namespace klas
{
	//! A rectangle is two things: a position (top left) and a dimension.
	template<class T = Real>
	class Rectangle
	{
		public:
			//! Ctor.
			Rectangle()
			{
			  x = 0.0,
			  y = 0.0,
			  w = 0.0,
			  h = 0.0;
			}
		
			//! Ctor.
			/* \param pos The position of the rectangle.
				 \param dim The dimensions of the rectangle. */
			Rectangle(const Vector2<T>& pos, const Vector2<T>& dim)
			{
				setPos(pos);
				setDim(dim);
			}
			
			//! Ctor.
			/* \param x Value of x on the top left.
				 \param y Value of y on the top top.
				 \param w Width of the rectangle
				 \param h Height of the rectangle. */
			Rectangle(T x, T y, T w, T h)
			{
				this->x = x,
				this->y = y,
				this->w = w,
				this->h = h;
			}
			
			
			//! Changes the position of x / y.
			/*! \param pos The new position of x / y. */
			void setPos(const Vector2<T>& pos)
			{
				x = pos.x,
				y = pos.y;
			}
			
			//! Changes the dimensions of the rect.
			/*! \param dim The new dimensions. */
			void setDim(const Vector2<T>& dim)
			{
				w = dim.x,
				h = dim.y;
			}
			
			//! Gets the position of the rectangle.
			/*! \return A Vector2 with the position of the rectangle. */
			Vector2<T> getPos() const
			{
			  return Vector2<T>(x, y);
			}
			
			//! Gets the dimensions of the rectangle.
			/*! \return A Vector2 with the dimensions of the rectangle. */
			Vector2<T> getDim() const
			{
			  return Vector2<T>(w, h);
		  }
			
			//! x coordinate
			T x,
			
			//! y coordinate
				y,
		
			//! width of the rectangle.
				w,
				
			//! height of the rectangle.
				h;
	};
}
#endif
